Skip to content

feat: add webcam support to Hand Pose demo#302

Open
ojayballer wants to merge 2 commits into
opencv:mainfrom
ojayballer:fix-handpose-demo
Open

feat: add webcam support to Hand Pose demo#302
ojayballer wants to merge 2 commits into
opencv:mainfrom
ojayballer:fix-handpose-demo

Conversation

@ojayballer
Copy link
Copy Markdown

Motivation

Currently, the Hand Pose demo script crashes when providing a webcam index (e.g., --input 0) because it attempts to load "0" as an image file.

Modification

This PR adds input validation to demo.py:

  • Checks if args.input is a digit using .isdigit().
  • If it is a digit, it initializes the webcam (cv.VideoCapture) and runs inference in a loop.
  • If it is not, it proceeds with the existing single-image loading logic.

Verification

  • Tested with webcam: python demo.py --input 0 (Successful skeleton tracking)
  • Tested with image: python demo.py --input hand.jpg (Backwards compatibility preserved)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant